import axios from "../request";

interface louPan {
  img?: string; // 封面
  type?: string; // 分类
  city?: string; // 城市
  area?: string; // 区域
  state?: string; // 发布/未发布
  publisher?: string; // 创建人
  time?: string; // 发布时间
  name?: string; //  楼盘名称
  size?: string; //  套房大小
  price?: string; // 价格
}

// 获取楼盘数据汇总  （包括广州、北京、上海、深圳的分类）
export const getTcitys = async () => {
  const res = await axios.get("/loupan/tcitys");
  return res;
};
// 广州
export const getGz = async () => {
  const res = await axios.get("/loupan/tcitys/广州");
  return res;
};
// 上海
export const getSh = async () => {
  const res = await axios.get("/loupan/tcitys/上海");
  return res;
};
// 北京
export const getBj = async () => {
  const res = await axios.get("/loupan/tcitys/北京");
  return res;
};
// 深圳
export const getSz = async () => {
  const res = await axios.get("/loupan/tcitys/深圳");
  return res;
};
// 楼盘管理 增 删(传_id) 改
export const addLoupan = async (data: louPan) => {
  const res = await axios.post("/loupan/addLoupan", {
    ...data
  });
  return res;
};
export const delLoupan = async () => {
  const res = await axios.post("/loupan/del");
  return res;
};
// 改
export const editLoupan = async (id: number | string, data: louPan) => {
  const res = await axios.post(`/loupan/editLoupan/${id}`, {
    ...data
  });
  return res;
};
// 删
export const removedataone = async (id: number | string) => {
  const res = await axios.post(`/loupan/removedata/${id}`);
  return res;
};
// 轮播图
export const banner = async () => {
  const res = await axios.get("/data/banner");
  return res;
};

export default {};
